<?php
namespace App\Logic\kyc;

use Illuminate\Support\Facades\DB;
use Xrjyz\Curl\Curl;

class Kyc
{
    public static function level_one($trueName,$idenNo)
    {


        $new_api_config = [
            'url' => 'https://netocr.com/verapi/veridenNo.do',
            'key' => 'KayGrv6RV6eaqQhsWPgmgi',
            'secret' => '957af1fe2f6e46d0ae4ee5e27413ce20',
        ];
        $curl = new Curl;
        $curl->post('key',$new_api_config['key'])
            ->post('secret',$new_api_config['secret'])
            ->post('trueName',$trueName)
            ->post('idenNo',$idenNo)
            ->post('typeId',3001)
            ->post('format','json')
            ->url($new_api_config['url']);

        if ( $curl->error() ) {
            return e_msg(300009,$curl->message());
        }
        if($curl->info()['http_code'] == 200){

            $content = $curl->data();
            $info = json_decode($content,true);
            return s_msg('',$info);

        }else{
            return e_msg(300009,'响应异常'.$curl->info()['http_code']);
        }
    }


    public static function level_two($pic)
    {


        $new_api_config = [
            'url' => 'https://netocr.com/api/recogliu.do',
            'key' => 'KayGrv6RV6eaqQhsWPgmgi',
            'secret' => '957af1fe2f6e46d0ae4ee5e27413ce20',
        ];
        $curl = new Curl;


        $curl ->post('img',$pic)
            ->post('key',$new_api_config['key'])
            ->post('secret',$new_api_config['secret'])
            ->post('typeId',101)
            ->post('format','json')
            ->url($new_api_config['url']);

        if ( $curl->error() ) {
            return e_msg(300009,$curl->message());
        }
        if($curl->info()['http_code'] == 200){

            $content = $curl->data();
            $info = json_decode($content,true);
            return s_msg('',$info);

        }else{
            return e_msg(300009,'响应异常'.$curl->info()['http_code']);
        }
    }
    public static function level_three($pos,$face)
    {


        $new_api_config = [
            'url' => 'https://netocr.com/api/faceliu.do',
            'key' => 'KayGrv6RV6eaqQhsWPgmgi',
            'secret' => '957af1fe2f6e46d0ae4ee5e27413ce20',
        ];
        $curl = new Curl;


        $curl ->post('img1',$pos)
            ->post('img2',$face)
            ->post('key',$new_api_config['key'])
            ->post('secret',$new_api_config['secret'])
            ->post('typeId',9999)
            ->post('format','json')
            ->url($new_api_config['url']);

        if ( $curl->error() ) {
            return e_msg(300009,$curl->message());
        }
        if($curl->info()['http_code'] == 200){

            $content = $curl->data();
            $info = json_decode($content,true);
            return s_msg('',$info);

        }else{
            return e_msg(300009,'响应异常'.$curl->info()['http_code']);
        }
    }
}





